/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

/**
 *
 * @author Mickey
 * this class represent an individual user which is used to generate new users and then store that data to the linked list
 */

public class User {
    private String name;
    private String email;
    private String userID;
    private String password;
    private int loginAttempts=0;
    private boolean isLocked;
    
    public boolean equals(User other) {
        if (userID.equals(other.getUserID())) {
            return true;
        }
        else {
            return false;
        }
    }

    @Override
    public String toString() {
        return userID;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUserID() {
        return userID;
    }

    public void setUserID(String userID) {
        this.userID = userID;
    }
    
    public int getLoginAttempts(){
        return loginAttempts;
    }
    
    public void setLoginAttempts(String num){
        this.loginAttempts = Integer.parseInt(num);
    }
    
    public void incrementLoginAttempts(){
        this.loginAttempts++;
    }
    
    public void resetLoginAttempts(){
        this.loginAttempts = 0;
    }
    
    public void unLock(){
        loginAttempts=0;
        this.isLocked = false;
    }
    public boolean isLocked(){
        if(getLoginAttempts()>1){
            isLocked = true;
        }
        else{
            isLocked = false;
        }
        return isLocked;
    }
    
    public void setIsLocked(String state){
        if(state.equals("true")){
            this.isLocked = true;
        }
        else{
            this.isLocked = false;
        }
    }
    
    public String getIsLocked(){
        if(this.isLocked == true){
            return "true";
        }
        else{
            return "fales";
        }
    }

}
